package com.itcast.n9_垃圾回收;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @program: jvm
 * @description:
 * @author: flyduck
 * @create: 2024-10-08 11:44
 **/
//-XX:+UseParNewGC -XX:+UseConcMarkSweepGC  -Xms60m -Xmn20m -Xmx60m -XX:SurvivorRatio=3   -XX:+PrintGCDetails
//[GC (Allocation Failure) [ParNew: 15731K->3234K(16384K), 0.0158442 secs] 20853K->20457K(57344K), 0.0158865 secs] [Times: user=0.08 sys=0.00, real=0.02 secs]
//
//[GC (CMS Initial Mark) [1 CMS-initial-mark: 28487K(40960K)] 32603K(57344K), 0.0003638 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
//[CMS-concurrent-mark-start]
//[CMS-concurrent-mark: 0.002/0.002 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
//[CMS-concurrent-preclean-start]
//[CMS-concurrent-preclean: 0.000/0.000 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
//[GC (CMS Final Remark) [YG occupancy: 4116 K (16384 K)][Rescan (parallel) , 0.0002999 secs][weak refs processing, 0.0000971 secs][class unloading, 0.0003495 secs][scrub symbol table, 0.0007350 secs][scrub string table, 0.0002668 secs][1 CMS-remark: 28487K(40960K)] 32603K(57344K), 0.0019700 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
// gc.parnew   gc.concurrentmarksweep
public class Test19_垃圾回收器_验证加上UseParNewGC和UseConcMarkSweepGC参数年轻代使用ParNew老年代使用cms {
    public static void main(String[] args) throws IOException {
        List<Object> list = new ArrayList<>();
        int count = 0;
        while (true){
            System.in.read();
            System.out.println(++count);
            //每次添加1m的数据
            list.add(new byte[1024 * 1024 * 1]);
        }
    }
}
